package com.nnxy.worktostudy.security.security;

import com.nnxy.worktostudy.utils.ResponseFormat;
import com.nnxy.worktostudy.utils.ResponseUtil;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.AuthenticationEntryPoint;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @Author : lu'qz
 * @create 2021/9/22 18:11
 */
public class UnauthEntryPoint implements AuthenticationEntryPoint {
    @Override
    public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException) throws IOException, ServletException {
        ResponseUtil.out(response, ResponseFormat.failed().setMessage("权限不足！"));
    }
}
